package com.hmdp.controller;


import com.hmdp.dto.Result;
import com.hmdp.service.IFollowService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author scx
 * @since 2025-1-19
 */
@RestController
@RequestMapping("/follow")
@Slf4j
public class FollowController {
    @Autowired
    private IFollowService followService;


    @GetMapping("/or/not/{id}")
    public Result isFollow(@PathVariable("id") Long followUserId) {
        return followService.isFollow(followUserId);
    }

    @PutMapping("/{id}/{isFollow}")
    public Result follow(@PathVariable("id") Long followUserId, @PathVariable("isFollow") Boolean isFollow) {
        log.info("关注?:{},{}", followUserId,isFollow.toString());
        return followService.follow(followUserId, isFollow);
    }

    @GetMapping("/common/{id}")
    public Result commonFollow(@PathVariable("id") Long id) {
        log.info("共同关注：{}",id);
        return followService.followCommons(id);
    }
}
